import type { AxiosResponse } from 'axios'
import request from '@/utils/request'

const serviceName = import.meta.env.VITE_APP_SREVICE_NAME_CITY_MANAGEMENT

/**
 * 日程接口
 */
class CalendarServe {
  list<T = any>(params: {
    scheduleDate?: string
    scheduleMonth?: string
  }): Promise<AxiosResponse<T>> {
    return request({
      url: `${serviceName}/schedule-helper/list`,
      method: 'get',
      params
    })
  }

  add<T = any>(data: { content: string; scheduleDate: string }): Promise<AxiosResponse<T>> {
    return request({
      url: `${serviceName}/schedule-helper/create`,
      method: 'post',
      data
    })
  }

  update<T = any>(data: {
    id: number
    content?: string
    scheduleDate?: string
  }): Promise<AxiosResponse<T>> {
    return request({
      url: `${serviceName}/schedule-helper/modify`,
      method: 'post',
      data
    })
  }

  delete<T = any>(params: { scheduleId: string }): Promise<AxiosResponse<T>> {
    return request({
      url: `${serviceName}/schedule-helper/delete`,
      method: 'get',
      params
    })
  }
}
export default new CalendarServe()
